<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUserSettingTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('user_setting', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
            $table->unsignedTinyInteger('show_charm')->default(1)->comment('是否显示魅力值');
            $table->unsignedTinyInteger('show_location')->default(1)->comment('是否显示地理位置');
            $table->unsignedTinyInteger('show_gift')->default(1)->comment('是否显示礼物墙');
            $table->timestamps();
            $table->unsignedTinyInteger('flag')->default(1)->comment('记录有效');
            $table->index('user_id', 'user_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_setting');
    }
}
